local shuncongsiwang = fk.CreateSkill{
    name = "ym2__shuncongsiwang",
}
Fk:loadTranslationTable{
    ["ym2__shuncongsiwang"] = "日轮啊，顺从死亡",
    [":ym2__shuncongsiwang"] = "当你手牌花色数增加至四时，你将手牌弃至一并视为使用一张【决斗】。你使用牌时，若你没有该花色的手牌，你可摸两张牌。",
    ["#ym2__shuncongsiwang_viewas"] = "日轮啊，顺从死亡",
    ["#ym2__shuncongsiwang-ask"] = "日轮啊，顺从死亡：你将手牌弃至一并视为使用一张【决斗】",
    ["#ym2__shuncongsiwang-invoke"] = "日轮啊，顺从死亡：你可以摸两张牌",

    ["$ym2__shuncongsiwang1"] = "スーリヤよ、ご照覧あれ。もはや戦場に呵責なし。我が父よ、許したまえ。空前絶後、『日輪よ、死に随え』！",
    ["$ym2__shuncongsiwang2"] = "神々の王の慈悲を知れ。絶滅とは是、この一刺し。インドラよ、刮目しろ。焼き尽くせ、『日輪よ、死に随え』！ ……是非もなし",
    ["$ym2__shuncongsiwang3"] = "哼…",
    ["$ym2__shuncongsiwang4"] = "哈！",
    ["$ym2__shuncongsiwang5"] = "噻！",
}
shuncongsiwang:addEffect(fk.CardUsing,{
    anim_type = "drawcard",
    audio_index = {3,4,5},
    can_trigger = function(self, event, target, player, data)
        return target == player and player:hasSkill(shuncongsiwang.name) and
        not table.find(player:getCardIds("h"), function(id)
            return Fk:getCardById(id).suit == data.card.suit
        end)
    end,
    on_cost = function (self, event, target, player, data)
        if player.room:askToSkillInvoke(player,{
            skill_name = shuncongsiwang.name,
            prompt = "#ym2__shuncongsiwang-invoke",
        }) then
            return true
        end
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        player:drawCards(2,shuncongsiwang.name)
    end,
})
shuncongsiwang:addEffect(fk.AfterCardsMove,{
    anim_type = "offensive",
    audio_index = {1,2},
    can_trigger = function(self, event, target, player, data)
        local suits = {}
        table.forEach(player:getCardIds("h"), function (id)
            if not table.contains(suits, Fk:getCardById(id).suit) then
                table.insertIfNeed(suits, Fk:getCardById(id).suit)
            end
        end)
        if player:hasSkill(shuncongsiwang.name) and #suits == 4 and player:getMark("ym2__shuncongsiwang") == 1 then
            for _, move in ipairs(data) do
                if move.to == player and move.toArea == Player.Hand then return true end
                if move.from == player and table.find(move.moveInfo, function(info) return info.fromArea == Player.Hand end) then
                    player.room:setPlayerMark(player,"ym2__shuncongsiwang",0)
                    return true
                end
            end
        end
    end,
    on_cost = function (self, event, target, player, data)
        local room = player.room
        local card = Fk:cloneCard("duel")
        card.skillName = shuncongsiwang.name
        if #card:getDefaultTarget(player) > 0 then
            local bool, dat = room:askToUseActiveSkill(player,{
                skill_name = "#ym2__shuncongsiwang_viewas",
                prompt = "#ym2__shuncongsiwang-ask",
                cancelable = false,
            })
            if bool and dat then
                event:setCostData(self, {targets = dat.targets, cards = dat.cards})
                return true
            end
        end
    end,
    on_use = function (self, event, target, player, data)
        local room = player.room
        room:throwCard(event:getCostData(self).cards, shuncongsiwang.name, player, player)
        local card = Fk:cloneCard("duel")
        card.skillName = shuncongsiwang.name
        local use = { from = player, tos = event:getCostData(self).targets, card = card}
        room:useCard (use)
    end,
})
shuncongsiwang:addEffect(fk.AfterCardsMove,{
    can_refresh = function (self, event, target, player, data)
        local suits = {}
        table.forEach(player:getCardIds("h"), function (id)
            if not table.contains(suits, Fk:getCardById(id).suit) then
                table.insertIfNeed(suits, Fk:getCardById(id).suit)
            end
        end)
        return #suits ~= 4
    end,
    on_refresh = function (self, event, target, player, data)
        player.room:setPlayerMark(player,"ym2__shuncongsiwang",1)
    end,
})
shuncongsiwang:addAcquireEffect(function (self, player, is_start)
    local suits = {}
    table.forEach(player:getCardIds("h"), function (id)
        if not table.contains(suits, Fk:getCardById(id).suit) then
            table.insertIfNeed(suits, Fk:getCardById(id).suit)
        end
    end)
    if #suits == 4 then
        player.room:setPlayerMark(player,"ym2__shuncongsiwang",0)
    else
        player.room:setPlayerMark(player,"ym2__shuncongsiwang",1)
    end
end)
return shuncongsiwang